#include    "ept-converter.h"

//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
EPTConverter::EPTConverter(QObject *parent) : Device(parent)
  , U_bat(0)
  , r(0)
  , ks(1.145)
  , U_out(0.0)
  , I_out(0.0)
{

}

//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
EPTConverter::~EPTConverter()
{

}

//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
void EPTConverter::preStep(state_vector_t &Y, double t)
{
    Q_UNUSED(Y)
    Q_UNUSED(t)

    U_out = ks * U_bat - r * I_out;
}

//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
void EPTConverter::ode_system(const state_vector_t &Y,
                              state_vector_t &dYdt, double t)
{
    Q_UNUSED(Y)
    Q_UNUSED(dYdt)
    Q_UNUSED(t)
}

//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
void EPTConverter::load_config(CfgReader &cfg)
{
    QString secName = "Device";

    cfg.getDouble(secName, "r", r);
    cfg.getDouble(secName, "ks", ks);
}
